<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/jquery-2.1.0.min.js"></script>
    <script>
        function fun() {
            $.ajax({
                url:"/ajaxServlet",
                type:"post",
                data:{"username":"jack","age":23},
                success:function (data) {
                    console.log(data)
                },
                error:function (err) {
                    console.log(err.status)
                },
                dataType:"text"
            })
        }
    </script>
</head>
<body>
<input type="button" value="发送异步请求" onclick="fun();">

</body>
</html>